<?php
defined('OA_LIB_PATH') || define('OA_LIB_PATH', '/opt/op/OALib');
defined('OPEN_LIB_PATH') || define('OPEN_LIB_PATH', '/opt/op/OpenLib');

require_once 'PHPUnit/Framework.php';
require_once 'Log.php';
require_once OPEN_LIB_PATH . '/open/models/OaServiceOPLogModel.php';

class OaServiceOPLogModelTest extends PHPUnit_Framework_TestCase
{
    private $_logger;
    private $_model;
    
    protected function setUp()
    {
        $logger = Log::factory('console');
        $logger->setMask(Log::MAX(PEAR_LOG_DEBUG));
        $this->_logger = $logger;
        $this->_model = new OaServiceOPLogModel();
    }
    
    protected function tearDown()
    {
        
    }
    
    public function testGetServiceOPStatus()
    {
        $this->markTestSkipped();
        $result = $this->_model->getServiceOPStatus();
        print_r($result);
        $this->assertTrue(is_string($result));
    }
    
    public function testGetServiceOPType()
    {
        $this->markTestSkipped();
        $result = $this->_model->getServiceOPType();
        $this->assertTrue(is_array($result));
    }
    
    public function testCreateServiceOPLog()
    {
        $this->markTestSkipped();
        $taskId = '12161';
        $row = array(
            'op_type'=>OaServiceOPLogModel::OP_TYPE_SERVICE_AUTHEN, 'status'=>OaServiceOPLogModel::OPERATION_UNDO, 'data'=>'654324',
            'method_type'=>OaServiceOPLogModel::METHOD_TYPE_ADD,'environment'=>1
        );
        $result = $this->_model->createServiceOPLog($taskId, $row);
        $this->assertTrue($result!==false);
    }
    public function testModifyServiceOPLog()
    {
//        $this->markTestSkipped();
        $row = array(
            'op_type'=>OaServiceOPLogModel::OP_TYPE_SERVICE_QUANQUAN, 'status'=>OaServiceOPLogModel::OPERATION_UNDO, 'data'=>'654443216789',
            'method_type'=>OaServiceOPLogModel::METHOD_TYPE_UPDATE,'environment'=>1
        
        );
        $result = $this->_model->modifyServiceOPLog($row, '29900262e156e1e0653445587967e664');
        $this->assertTrue($result!==false);
    }
    public function testDeleteServiceOPLog()
    {
        $this->markTestSkipped();
        $row = array(
            'op_type'=>OaServiceOPLogModel::OP_TYPE_SERVICE_QUANQUAN, 
            'operation_id'=>'950d4c4b71edf83a68d3dd1ff8c11b89',
            'task_id'=>'12161'
        );
        $result = $this->_model->deleteServiceOPLog($row);
        $this->assertTrue($result!==false);
    }
    public function testGetServiceOPLog()
    {
        $this->markTestSkipped();
        $row = array(
            'op_type'=>OaServiceOPLogModel::OP_TYPE_SERVICE_AUTHEN, 
            'operation_id'=>'29900262e156e1e0653445587967e664',
            'task_id'=>'12161'
        );
        $result = $this->_model->getServiceOPLog($row);
        print_r($result);
        $this->assertTrue(is_array($result));
    }
    
    public function testGetServiceOPLogCount()
    {
        $this->markTestSkipped();
        $row = array(
            'op_type'=>OaServiceOPLogModel::OP_TYPE_SERVICE_QUANQUAN, 
            'operation_id'=>'29900262e156e1e0653445587967e664',
            'task_id'=>'12161'
        );
        $result = $this->_model->getServiceOPLogCount($row);
        print_r($result);
        $this->assertTrue(is_int($result));
    }
    public function testGetServiceOPLogList()
    {
        $this->markTestSkipped();
        $row = array(
            'op_type'=>OaServiceOPLogModel::OP_TYPE_SERVICE_QUANQUAN, 
            'operation_id'=>'29900262e156e1e0653445587967e664',
            'task_id'=>'12161'
        );
        $result = $this->_model->getServiceOPLogList($row);
        print_r($result);
        $this->assertTrue(is_array($result));
    }
    public function testGetUniqueLogId()
    {
        $this->markTestSkipped();
        $result = $this->_model->getUniqueLogId();
        echo $result."\n";
        $this->assertTrue(is_string($result));
    }
}
